package com.ytjj.qmyx.data.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.data.service.OrderRecordService;
import com.ytjj.qmyx.data.service.impl.PageStatisticsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description 刷新缓存
 * @ClassName RefreshController
 *
 *
 * @Version 1.0
 **/
@RestController
@RequestMapping("/refreshCache")
public class RefreshController {

    @Resource
    private PageStatisticsServiceImpl pageStatisticsServiceImpl;
    @Autowired
    private OrderRecordService orderRecordService;
    /**
     * @Description 刷新pathCode缓存
     *
     *
     *
     * @Version 1.0
     **/
    @GetMapping("/refreshPathCode")
    public CommonResult refreshPathCode() {
        pageStatisticsServiceImpl.fillPathCodeMap();
        return CommonResult.success();
    }

    /**
     * 批量发送数据到kafka
     * @param startTime
     * @return
     */
    @GetMapping("/sendHistoryDataToKafka")
    public CommonResult sendHistoryDataToKafka(String startTime) {
        orderRecordService.sendHistoryDataToKafka(startTime);
        return CommonResult.success();
    }
}
